//
// Created by Administrator on 2025/3/10.
//

#include "jicheng.h"
using namespace std;

class jicheng {
private:
    int attr_private = 1;
    int atttr_protect = 2;
    int attr_public = 3;
    jicheng() {
        attr_private = 1000;
        attr_public = 2000;
        attr_public = 3000;
    }
public:
    jicheng(int pri,int pro, int pub) {
        attr_private = pri;
        atttr_protect = pro;
        attr_public = pub;

    }
    int sum() {
        return attr_private + atttr_protect + attr_public;
    }

    ~jicheng() {
        std::cout <<   "jicheng is deleted !" <<  attr_private << endl;
    }

};

class jicheng2 :public jicheng {
    private:
    int mi = 100;
public:
    jicheng2(int pri,int pro,int pub ):jicheng(pri,pro,pub){
        mi = 200;
        cout << "jicheng2 is created !" << endl;
    }
    jicheng2(): jicheng(111,22,33) {
        cout << "jicheng2 is created !" << endl;
        mi = 300;
    }

    int show_mi() {
        return mi;
    }

};

class jicheng3 {
    public:
    jicheng3() {
        cout << "jicheng3 is created !" << endl;
    }
    ~jicheng3() {
        cout << "jicheng3 is deleted !" << endl;
    }
};



int main1() {
    // jicheng *ji = new jicheng(1,2,3);
    // int res =  ji->sum();
    // cout << res << endl;
    // delete ji;
    //
    // jicheng2 *j2 = new jicheng2(100,200,300);
    // // jicheng2 j3;
    //
    // cout << j2->sum() << endl;
    // int temp = j2->show_mi();
    // cout << temp << endl;
    //
    // delete j2;
    // j31 不是通过new 方式创建的，属于局部变量
    jicheng3 j31;
    // j32 是通过new jicheng3 动态创建了一个jicheng3 对象，并将其地址赋给了指针j32。new 的方式
    jicheng3 *j32 = new jicheng3();
    delete j32;

    return 0;
}